<template>
<div style="height: 100%;">
    <el-container>
        <el-header>
            <div class="top_menu_left">
                <div class="zhihu"  @click="goIndex">知乎</div> 
                <div class="shu"></div>
                <div class="top_wenz">写文章</div>
            </div>
            <div class="avant">
                <img src="@/assets/logo.png" alt="">
            </div>
        </el-header>
        <el-main>
            <div style="width: 1000px;height: 100%; margin: 0 auto;">
                <div class="el_main_box">
                    <div class="top_input_bi" >
                       <input type="text"
                       v-model="title"
                        placeholder="请输入文章标题">
                    </div>
                    <div class="line"></div>
                    <quill-editor
                    style="background-color: #fff;"
                    v-model="content"
                    ref="myQuillEditor"
                    :options="editorOption"
                    @blur="onEditorBlur($event)"
                    @focus="onEditorFocus($event)"
                    @change="onEditorChange($event)"
                    @ready="onEditorReady($event)"
                    />
                    <div class="line"></div>

                    <div class="grop">
                        <el-checkbox-group v-model="checkList">
                            <el-checkbox label="生活类"></el-checkbox>
                            <el-checkbox label="科技类"></el-checkbox>
                            <el-checkbox label="娱乐类"></el-checkbox>
                        </el-checkbox-group>
                    </div>
                    <div class="btn_sub">
                      <el-button type="primary" v-show="title!==''&& content !== '' && checkList.length > 0" @click="tab">发布</el-button>
                      <el-button type="primary" 
                      v-show="title==''|| content == '' || checkList.length == 0"
                      disabled
                      @click="tab"
                      >发布</el-button>
                    </div>
                </div>
            </div>
        </el-main>
    </el-container>
</div>
</template>
<script>
export default {
    data() {
        return{
            content: "",
            TiLength:0,
            // 富文本编辑器配置
            editorOption: {
               placeholder: "请输入正文",
            },
            checkList: [],
            title:''
        }
    },
    methods:{
        tab(){
            console.log(this.content,this.checkList,this.title);
        },
        goIndex(){
            this.$router.push('/')
        },
        onSubmit() {
      console.log("submit!");
    },
    // 失去焦点事件
    onEditorBlur(quill) {
      console.log("editor blur!", quill);
    },
    // 获得焦点事件
    onEditorFocus(quill) {
      console.log("editor focus!", quill);
    },
    // 准备富文本编辑器
    onEditorReady(quill) {
      console.log("editor ready!", quill);
    },
    // 内容改变事件
    onEditorChange({ quill, html, text }) {
      console.log("editor change!", quill, html, text);
      this.content = html;
    },
    }
}
</script>
<style lang="scss" scoped>
.line{
    height: 30px;
    width: 100%;
    background-color: #fff;
}
.el-container {
    height: 100%;
}
.el-main {
    background-color: #f6f6f6;
    height: 100%;
    .top_input_bi {
    width: 1000px;
    height: 75px;
    background-color: #fff;
    input {
        font-size: 26px;
        font-weight: 700;
        width: 100%;
        height: 100%;
        padding: 20px;
        box-sizing: border-box;
        outline: #ccc;
         }
    }
    .grop,.btn_sub {
        padding: 30px 20px;
        background-color: #fff;
    }
    .btn_sub {
        display: flex;
        justify-content: flex-end;
    }
}

.el-header {
    width: 1000px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.top_menu_left {
    font-size: 20px;
    font-weight: 500;
    margin-right: 35px;
    display: flex;
    align-items: center;
}
.top_menu_left:hover{
    cursor: pointer;
}
.el-menu {
    margin-right: 35px;
}
.top_input {
    position: relative;
    width: 400px;
    height: 30px;
    /* background-color: #415281; */
    border-radius: 40px;

}
.zhihu {
    font-size: 24px;
    font-weight: 700;
    color: rgb(5, 109, 232);
}
.shu {
    background-color: #ebebeb;
    height: 29px;
    width: 1px;
    margin: 0 20px;
}
.top_wenz {
    font-weight: 600;
    font-size: 16px;
}
.top_input input {
    width: 100%;
    height: 100%;
    outline: none;
    color: #666;
    border: none;
    background-color: #F6F6F6;
    border-radius: 30px;
    padding: 0 42px 0 10px;
    box-sizing: border-box;
    opacity: 1;
}
input:focus {
    outline: none;
 }
.top_input img {
    position: absolute;
    right: 10px;
    top: 0;
    width: 30px;
    height: 30px;
}
.button_ques {
    width: 70px;
    height: 30px;
    text-align: center;
    line-height: 30px;
    color: #78A9E6;
    background-color: #E8EAF0;
    border-radius: 40px;
    margin-left: 30px;
}
.top_menu_left:hover {
   cursor: pointer;
}
.avant {
    width: 35px;
    height: 35px;
    margin-left: 60px;
}
.avant img {
    width: 100%;
    height: 100%;
}
</style>